package cn.huiyunche.base.service.interfaces;

import cn.huiyunche.base.service.vo.Result;
import cn.huiyunche.base.service.vo.WeixinNewsMessageVo;
import cn.huiyunche.base.service.vo.WeixinTextMessageVo;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 微信对外接口服务层
 *
 * @author hdy [Tuffy]
 */
public interface WeixinService {

    /**
     * 初始化微信url认证
     *
     * @param signature 微信加密签名
     * @param timestamp 时间戳
     * @param nonce     随机数
     * @return 验证状态
     * @throws IOException 异常
     */
    boolean checkSignature(String signature, String timestamp, String nonce);

    /**
     * 跳转页面
     *
     * @param request 请求
     * @param menu    菜单配置值
     * @return 页面url
     * @throws IOException 异常
     */
    String start(HttpServletRequest request, String menu) throws IOException;

    /**
     * 首页面
     *
     * @param code 微信用户code编码
     * @return 结果集
     * @throws IOException
     */
    ModelAndView index(String code, String menu) throws IOException;

    /**
     * 发送微信消息
     *
     * @return
     * @throws IOException
     */
    Result<Object> sendWeixinTextMsg(WeixinTextMessageVo wtmv) throws IOException;

    /**
     * 发送微信图文消息
     *
     * @return
     * @throws IOException
     */
    Result<Object> sendWeixinNewsMsg(WeixinNewsMessageVo wtmv) throws IOException;

}
